<template>
<view class="flex-yh">
  <Header>
    <view class="header">{{title | setTitle}}</view>
  </Header>
  <button @click="changeTitle">按钮</button>
  <button @click="goToIndex">首页</button>
</view>
</template>
<script>
export default {
  data() {
    return {
      title:'这里只能用flex布局',
    }
  },
  created() {
    console.log('login')
    uni.$on('add', this.add)
  },
  methods: {
    add(e) {
      console.log(e)
    },
    goto(_url){
      console.log(_url)  
    },
    changeTitle(){
      this.title = '标题';
    },
    goToIndex(){
      uni.switchTab({url:'/pages/index/index'} );
    }
  },
  filters:{
    setTitle(val){
      return val+'xxxx'
    }
  }
}
</script>

<style>
.header{ background: red; flex:1; display:flex; align-items:center;}
</style>
